home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / xarchie-2.0.9 / vl_comp.c < prev    next >
C/C++ Source or Header  |  1995-06-18  |  2KB  |  74 lines

  1. /*
  2.  * Copyright (c) 1989, 1990, 1991 by the University of Washington
  3.  *
  4.  * For copying and distribution information, please see the file
  5.  * <copyright.h>.
  6.  */
  7.  
  8. #include <copyright.h>
  9. #include <pfs.h>
  10.  
  11. /*
  12.  * vl_comp - compare the names of two virtual links
  13.  *
  14.  *           VL_COMP compares the names of two links.  It returns
  15.  *           0 if they are equal, negative if vl1 < vl2, and positive if
  16.  *           vl1 > vl2.
  17.  *
  18.  *    ARGS:  vl1,vl2 - Virtual links to be compared
  19.  * 
  20.  * RETURNS:  0 if equal, + is vl1 > vl2, - if vl1 < vl2
  21.  *
  22.  *   NOTES:  Order of significance is as follows.  Existence,
  23.  *           name.  If names do not exist, then hosttype, host,
  24.  *           native filenametype, native filename.  The only time
  25.  *           the name will not exist if if the link is a union link.
  26.  */
  27. int
  28. vl_comp(vl1,vl2)
  29.     VLINK    vl1;
  30.     VLINK    vl2;
  31.     {
  32.     int    retval;
  33.  
  34.     if(vl1->name && !vl2->name) return(1);
  35.     if(!vl1->name && vl2->name) return(-1);
  36.     if(vl1->name && vl2->name && (*(vl1->name) || *(vl2->name)))
  37.         return(strcmp(vl1->name,vl2->name));
  38.  
  39.     retval = strcmp(vl1->hosttype,vl2->hosttype);
  40.     if(!retval) retval = strcmp(vl1->host,vl2->host);
  41.     if(!retval) retval = strcmp(vl1->nametype,vl2->nametype);
  42.     if(!retval) retval = strcmp(vl1->filename,vl2->filename);
  43.     return(retval);
  44.     }
  45.  
  46. /*
  47.  * vl_equal - compare the values of two virtual links
  48.  *
  49.  *           VL_EQUAL compares the values of two links.  It returns
  50.  *           1 if all important fields are the same, and 0 otherwise.
  51.  *
  52.  *    ARGS:  vl1,vl2 - Virtual links to be compared
  53.  * 
  54.  * RETURNS:  1 if equal, 0 if not equal
  55.  *
  56.  */
  57. int
  58. vl_equal(vl1,vl2)
  59.     VLINK    vl1;
  60.     VLINK    vl2;
  61.     {
  62.       return strcmp(vl1->name, vl2->name) == 0         &&
  63.          vl1->linktype == vl2->linktype            &&
  64.          strcmp(vl1->type, vl2->type) == 0         &&
  65.          strcmp(vl1->hosttype, vl2->hosttype) == 0 &&
  66.          strcmp(vl1->host, vl2->host) == 0         &&
  67.          strcmp(vl1->nametype, vl2->nametype) == 0 &&
  68.          strcmp(vl1->filename, vl2->filename) == 0 &&
  69.          vl1->version == vl2->version              &&
  70.          vl1->f_magic_no == vl2->f_magic_no        ;
  71.  
  72.     }
  73.  
  74.